import request from '@/utils/request'
import Cookies from 'js-cookie'

// 获取路由
export const getRouters = () => {
  return request({
    url: '/getRouters',
    method: 'get'
  })
}

export const getCategoryId = (query) => {
  return request({
    url: '/category/page',
    method: 'get',
    headers: {
      token: Cookies.get('Admin-Token')
    },
    params: query
  })
}



export const getGoods = (query) => {
  return request({
    url: '/goods/page',
    method: 'get',
    headers: {
      token: Cookies.get('Admin-Token')
    },
    params: query
  })
}
export const postGoods = (data) => {
  return   request({
    url: '/goods',
    headers: {
      token: Cookies.get('Admin-Token')    },
    method: 'post',
    data: data
  })

}
export function changeGoods(data) {
  return request({
    url: '/goods',
    headers: {
      token: Cookies.get('Admin-Token')    },
    method: 'put',
    data: data
  })
}

export function deleteGoods(data) {
  return request({
    url: '/goods/'+data,
    headers: {
      token: Cookies.get('Admin-Token')    },
    method: 'delete'
  })
}